﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace MeetingAssistant.ViewModel.Member
{
    public class CompanyVM
    {
        public CompanyVM()
        {
            Enabled = true;
        }

        [Display(Name = "公司ID")]
        public int Id { get; set; }

        [Required(ErrorMessage = "公司名称不能为空")]
        [Display(Name = "公司名称")]
        [StringLength(20)]
        public string CompanyName { get; set; }

        [Required(ErrorMessage = "公司信用代码不能为空")]
        [Display(Name = "信用代码")]
        //[RegularExpression(@"^\d + $")]
        [StringLength(18)]
        public string Code { get; set; }

        [Required(ErrorMessage = "公司地址不能为空")]
        [Display(Name = "公司地址")]
        [StringLength(300)]
        public string CompanyAddress { get; set; }

        [Display(Name = "是否激活")]
        public bool Enabled { get; set; }

        public string StrEnabled
        {
            get
            {
                return Enabled == true ? "是" : "否";
            }
        }
        [Display(Name = "更新时间")]
        public DateTime UpdateDate { get; set; }

        public string StrUpdateDate
        {
            get
            {
                return UpdateDate.ToString();
            }
            set { }
        }


        #region 根据用户表查询的负责人信息

        [Display(Name = "公司负责人")]
        [StringLength(20)]
        public string LeaderName { get; set; }

        [Display(Name = "负责人性别")]
        public bool LeaderSex { get; set; }
        public string StrSex
        {
            get
            {
                return LeaderSex == true ? "男" : "女";
            }
        }
        
        [Display(Name = "身份证号")]
        [StringLength(18)]
        public string LeaderIdentityNumber { get; set; }

        [Display(Name = "负责人电子邮件")]
        [StringLength(50)]
        public string LeaderEmail { get; set; }

        [Display(Name = "负责人电话")]
        [StringLength(50)]
        public string LeaderPhone { get; set; }

        [Display(Name = "负责人住址")]
        [StringLength(300)]
        public string LeaderAddress { get; set; }

        [Display(Name = "负责人所属部门")]
        [StringLength(50)]
        public string LeaderDepartment { get; set; }

        [Display(Name = "用户名")]
        [StringLength(20)]
        public string UserName { get; set; }

        #endregion

        public IList<UserVM> Users { get; set; }
    }
}
